import request from '@/utils/request'

// 获取地图配置
export function getMapConfig() {
  return request({
    url: '/map/config',
    method: 'get'
  })
}

// 地理编码（地址转坐标）
export function geocode(address) {
  return request({
    url: '/map/geocode',
    method: 'get',
    params: { address }
  })
}

// 逆地理编码（坐标转地址）
export function regeocode(location) {
  return request({
    url: '/map/regeocode',
    method: 'get',
    params: { location }
  })
}

// 搜索POI
export function searchPoi(keywords, location, radius) {
  return request({
    url: '/map/search-poi',
    method: 'get',
    params: {
      keywords,
      location,
      radius
    }
  })
}

// 全国范围搜索POI
export function searchPoiNationwide(keywords, city) {
  return request({
    url: '/map/search-poi-nationwide',
    method: 'get',
    params: {
      keywords,
      city
    }
  })
}
